import React from 'react'
import "./index.scss"
import { withRouter } from 'react-router-dom'
// import { useState, useEffect } from "react";
import Top from '../../../components/top'
import { ProductCard } from 'react-vant';
import { connect } from "react-redux"
function Sure(props) {
    let { cartList } = props
    // cartList = cartList || []
    console.log(cartList)
    return (
        <div className='box-Sure'>
            <div className='sure-top'>
                <Top title="订单确认"></Top>
            </div>
            <div className='sure-content'>
                <div className='sure-con'>
                {
                                    cartList.map((d, i) => {
                                        return (
                                            <ProductCard
                                                key={i}
                                                num={d.count}
                                                price={d.price}

                                                title={d.name}
                                                thumb={d.pic}
                                               
                                            />

                                        )
                                    })
                                }
                </div>
                <div className='sure-exp'>
                    <h3>添加备注</h3>
                    <textarea name="" id="" cols="100" rows="100"
                        placeholder='请输入口味、偏好等要求，不支持调换菜单哦'
                        className='sure-area'></textarea>
                </div>
                <div className='sure-bottom'>
                    <button className='left'>已落座&nbsp;|&nbsp;扫码下单</button>
                    <button className='right' 
                    onClick={()=>props.history.push("/Sure_order")}
                    >未落座&nbsp;|&nbsp;保存下单</button>
                </div>
            </div>
        </div>
    )
}
export default withRouter(
    connect(
        (state) => ({ cartList: state.cart }),
      
    )(Sure))
